package com.bw.wxy.factroy;

public class HttpFactory {
    private HttpFactory(){}

    private static HttpFactory httpFactory;

    public static HttpFactory getInstance(){
        if (httpFactory==null){
            httpFactory=new HttpFactory();
        }
        return httpFactory;
    }

    private HttpImpl upload,sign,token;

    public HttpImpl factory(HttpType type){
        HttpImpl http=null;
        switch (type){
            case UPLOADTYPE:
                if (upload==null){
                    upload=new UploadRetrofit.Build().build();
                }
                http=upload;
                break;
            case SINGTYPE:
                if (sign==null){
                    sign=new SignRetrofit.Build().build();
                }
                http=sign;
                break;
            case TOKENTYPE:
                if (token==null){
                    token=new TokenRetrofit.Build().build();
                }
                http=token;
                break;
        }
        return http;
    }
}

